
# # 定义员工类
# class Employee:
#
#     def __init__(self,eid,did,name,money):
#         self.eid = eid # 员工编号
#         self.did = did # 部门编号
#         self.name = name
#         self.money = money
#
#     def __str__(self):
#        return f"员工姓名：{self.name}，部门编号：{self.did}，员工编号：{self.eid}，工资是：{self.money}元"
# #
# #

class Employee:

    def __init__(self,eid,did,name,money):
        self.eid = eid # 员工编号
        self.did = did # 部门编号
        self.name = name
        self.money = money

    def __str__(self):
       return f"员工姓名：{self.name}，部门编号：{self.did}，员工编号：{self.eid}，工资是：{self.money}元"

list_employees = [
    Employee(1001,9001,"唐僧",60000),
    Employee(1002,9002,"孙悟空",50000),
    Employee(1003,9002,"猪八戒",40000),
    Employee(1004,9001,"沙僧",30000),
    Employee(1005,9001,"小白龙",1500),
]
#
#
# #1. 定义函数在员工列表中查找所有部门是9001的员工
# def find_1():
#     for item in list_employees:
#         if item.did == 9001:
#             yield item
#
# #2. 定义函数，在员工列表中查找所有姓名是2个字的员工
# def find_2():
#     for item in list_employees:
#         if len(item.name) == 2:
#             yield item
#
# print("=================================================")
#
# # 函数式编程实现
# #1. 定义回调函数在员工列表中查找所有部门是9001的员工
# def condition1(item):
#     return item.did == 9001
#
# # 2. 定义回调函数，在员工列表中查找所有姓名是2个字的员工
# def condition2(item):
#     return len(item.name) == 2
#
# # 3. 定义高阶函数
# def find_all(condition):
#     for item in list_employees:
#         if condition(item):
#             yield item
#
# for item in find_all(condition1):
#     print(item)
# print("-----------------------")
# for item in find_all(condition2):
#     print(item)

# def fun3(p1,p2):
#     return p1<p2
#
# fun4=lambda p1,p2:p1<p2
#
# print(fun3(1,3))
#
# fun=lambda :"hello xiaoyan"
# print(fun5())
# fun5=lambda p1,p2:print()
# def __init__(self,eid,did,name,money):
maxv=list_employees
for i in range(1,len(list_employees)):
    if maxv < list_employees[i]:
        maxv=list_employees
        print(maxv)
